home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Developer University / DUProjects / DataCopy / Sources / Part.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.0 KB  |  169 lines  |  [TEXT/CWIE]

  1. //========================================================================================
  2. //    Release Version:    $ ODF 1 $
  3. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  4.  
  5. //================================================================================
  6. #include "DataCopy.hpp"
  7.  
  8. #ifndef PART_H
  9. #include "Part.h"
  10. #endif
  11.  
  12. #ifndef CONTENT_H
  13. #include "Content.h"
  14. #endif
  15.  
  16. #ifndef BINDING_K
  17. #include "Binding.k"
  18. #endif
  19.  
  20. #ifndef FRAME_H
  21. #include "Frame.h"
  22. #endif
  23.  
  24. #ifndef SELECTION_H
  25. #include "Selection.h"        // CDataCopySelection
  26. #endif
  27.  
  28. // ----- Framework Layer -----
  29. #ifndef FWPRESEN_H
  30. #include "FWPresen.h"        // FW_CPresentation
  31. #endif
  32.  
  33. #ifndef FWUTIL_H
  34. #include "FWUtil.h"            // FW_Beep()
  35. #endif
  36.  
  37. #ifndef FWABOUT_H
  38. #include "FWAbout.h"        //::FW_About()
  39. #endif
  40.  
  41. // ----- OS Layer -----
  42. #ifndef FWMENU_H
  43. #include "FWMenu.h"            // FW_CMenuBar, FW_CPullDownMenu
  44. #endif
  45.  
  46. #ifndef FWCFMRES_H
  47. #include "FWCFMRes.h"        // FW_CSharedLibraryResourceFile
  48. #endif
  49.  
  50. #ifndef FWRESTYP_H
  51. #include "FWResTyp.h"        // MULTISTRINGRES
  52. #endif
  53.  
  54. #ifndef FWEVENT_H
  55. #include "FWEvent.h"        // FW_CMenuEvent
  56. #endif
  57.  
  58. #ifndef FWSUSINK_H
  59. #include "FWSUSink.h"        // FW_CStorageUnitSink
  60. #endif
  61.  
  62. #ifndef FWBARRAY_H
  63. #include "FWBArray.h"        // FW_CByteArray
  64. #endif
  65.  
  66. // ----- Foundation Layer -----
  67. #ifndef FWSTREAM_H
  68. #include <FWStream.h>        // FW_InitializeArchiving
  69. #endif
  70.  
  71. #ifndef FWMEMMGR_H
  72. #include "FWMemMgr.h"        // FW_CMemoryManager
  73. #endif
  74.  
  75. #ifndef FWSUSINK_H
  76. #include "FWSUSink.h"        // FW_CStorageUnitSink
  77. #endif
  78.  
  79. //--- OpenDoc ------------------------------------------------------------------
  80. #ifndef SOM_Module_OpenDoc_StdProps_defined
  81. #include <StdProps.xh>        // kODPropContents
  82. #endif
  83.  
  84. //==============================================================================
  85. #ifdef FW_BUILD_MAC
  86. #pragma segment DataCopy
  87. #endif
  88.  
  89. FW_DEFINE_AUTO(CDataCopyPart)
  90.  
  91. //==============================================================================
  92. CDataCopyPart::CDataCopyPart(ODPart* odPart)
  93.   :    FW_CPart(odPart, FW_gInstance, kPartInfoID),
  94.     fPresentation(NULL),
  95.     fPartContent(NULL)
  96. {
  97.     FW_END_CONSTRUCTOR
  98. }
  99.  
  100. //--------------------------------------------------------------------------------
  101. CDataCopyPart::~CDataCopyPart()
  102. {
  103.     FW_START_DESTRUCTOR
  104. }
  105.  
  106. //--------------------------------------------------------------------------------
  107. void 
  108. CDataCopyPart::Initialize(Environment* ev)    // Override
  109. {
  110.     FW_CPart::Initialize(ev);
  111.     CDataCopySelection* selection = FW_NEW(CDataCopySelection, (ev, fPartContent));
  112.     const ODType kMainPresentation = "Apple:Presentation:DataCopy";
  113.     const FW_Boolean kDefaultPresentation = true;
  114.     fPresentation = RegisterPresentation(ev, kMainPresentation, 
  115.                                             kDefaultPresentation, selection);
  116. }
  117.  
  118. //--------------------------------------------------------------------------------
  119. FW_Boolean 
  120. CDataCopyPart::DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent)    // Override
  121. {
  122.     FW_Boolean menuHandled = TRUE;
  123.     ODCommandID commandID = theMenuEvent.GetCommandID(ev);
  124.     
  125.     switch (commandID)
  126.     {
  127.         case kODCommandAbout:
  128.             ::FW_About(ev, this, kAbout);
  129.             break;
  130.  
  131.         default:
  132.             menuHandled = FALSE;
  133.     }
  134.     
  135.     return menuHandled;
  136. }
  137.  
  138. //--------------------------------------------------------------------------------
  139. FW_CFrame* 
  140. CDataCopyPart::NewFrame(Environment* ev, ODFrame* odFrame,
  141.                         FW_CPresentation* presentation, FW_Boolean fromStorage)    // Override
  142. {
  143.     FW_UNUSED(presentation);
  144.     FW_UNUSED(fromStorage);
  145.     return FW_NEW(CDataCopyFrame, (ev, odFrame, presentation, fPartContent));
  146. }
  147.  
  148. //------------------------------------------------------------------------------
  149. FW_CContent* 
  150. CDataCopyPart::NewPartContent(Environment* ev)
  151. {
  152.     fPartContent = FW_NEW(CDataCopyContent, (ev, this));
  153.     return fPartContent;
  154. }
  155.  
  156. //------------------------------------------------------------------------------
  157. void 
  158. CDataCopyPart::MyInvalidatePresentation(Environment* ev, FW_CRect& rect)
  159. {
  160.     fPresentation->Invalidate(ev, rect);
  161. }
  162.  
  163. //------------------------------------------------------------------------------
  164. void 
  165. CDataCopyPart::MyInvalidatePresentation(Environment* ev)
  166. {
  167.     fPresentation->Invalidate(ev);
  168. }
  169.